import moment from "moment"
const trainingTypeList ={
    "1":"线上",
    "2":"线下"
}
const statusList ={
    "1":"项目预告中",
    "2":"项目进行中",
    "3":"项目已结束"
}
const meetStaus ={
    "0":"未开始",
    "1":"进行中",
    "2":"已结束"
}
let arrJson = {
    trainingTypeList,
    statusList,
    meetStaus
}
function setStatus(startTime,endTime,type){
    startTime = moment(startTime).valueOf()
    endTime = moment(endTime).valueOf()
    let now = new Date().getTime()
    let status = 1
    if(now<startTime){
        status = 1
    }
    if(now>=startTime&&now<endTime){
        status = 2
    }
    if(now>=endTime){
        status = 3
    }
    if(type==2){
        if(status==1){
            return '项目未开始'
        }
    }
    return arrJson['statusList'][status]
}
function setStatusCss(startTime,endTime){
    startTime = moment(startTime).valueOf()
    endTime = moment(endTime).valueOf()
    let now = new Date().getTime()
    let status = 1
    if(now<startTime){
        status = 1
    }
    if(now>=startTime&&now<endTime){
        status = 2
    }
    if(now>=endTime){
        status = 3
    }
    return 'status'+status
}
function setData(type,e){
    return arrJson[type][e]
}
export default{
    setData,
    setStatus,
    setStatusCss
}